fix(streamable-http): reduce stateless termination log noise#2357
fix(streamable-http): reduce stateless termination log noise#2357BlocksecPHD wants to merge 3 commits intomodelcontextprotocol:mainfrom
Conversation
|
@claude review |
|
The change is focused and correct. A few observations: Code change: The conditional log level is the right approach — Test: Well-structured and mirrors the existing One minor nit: the For context: #1696 / #1697 is a docs PR covering stateless mode semantics more broadly — this fix and that documentation would complement each other well for users trying to understand what stateless mode does and doesn't do. |
Summary
This PR adjusts termination logging in
StreamableHTTPServerTransportfor stateless mode.INFOlog for stateful session termination (session id exists)DEBUGlog for stateless transport cleanup (mcp_session_id is None)This addresses confusion reported in #2329 where users interpret
Terminating session: Noneas an error condition.Changes
src/mcp/server/streamable_http.pyterminate()tests/server/test_streamable_http_manager.pyTerminating session: Nonemessage is not emittedValidation
Ran targeted tests locally:
python -m pytest tests/server/test_streamable_http_manager.py \ -k 'stateless_requests_memory_cleanup or stateless_termination_logs_debug_not_info'Result:
2 passed